home *** CD-ROM | disk | FTP | other *** search
- Date: Fri, 15 Jul 94 09:19:11 BST
- From: djs@jet.uk (David Stevenson)
- Message-Id: <9407150819.AA18194@YE.jet.uk>
- To: evanlang@uss.lonestar.org
- In-Reply-To: <m0qOUWr-0004q4C@uss.lonestar.org> (evanlang@uss.lonestar.org)
- Subject: Re: Alignment
-
-
- >If I cast a const char * such as "MiNT" or "LIVE" to a long *, shouldn't
- >the compiler store the string so that it is aligned to a long boundary?
- No. If the object is declared as char * (with or without const) it can
- be aligned on any byte boundary by a 68K compiler. Therefore it may
- be odd. Casting to long* makes no difference, the compiler is not going
- to then move the string to align it.
-
- >Otherwise, when trying to read the long at that address, it could be on
- >an odd address, and the machine dies.
- Address Error.
-
- >Lately, that is the way I've been reading strings to compare to cookie tags.
- >It has always worked, but when I changed main.c in mint, it crashes and I'm
- >pretty sure its because the 68K can't read a long from an odd address. Is
- >this a bug in the compiler, or is such a cast simply bad programming?
- Bad programming, I'm afraid.
-